#!/usr/bin/node
let EventEmitter = require('events').EventEmitter;
let emitter = new EventEmitter();

console.log('start...');

emitter.on('hello', function () {
  console.log('received hello event');
});

emitter.on('bye', function () {
  console.log('received bye event');
});

setTimeout(function () {
  emitter.emit('hello');
}, 500);

setTimeout(function () {
  emitter.emit('bye');
}, 2000);